package com.dawnClass.controller;

import com.dawnClass.service.CourseService;
import com.dawnClass.util.ServiceResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class IndexController {

  @Autowired
    private CourseService courseService;

    //首页加载新 3部分课数据
    @GetMapping("/index")
    public ModelAndView index(){
        ServiceResponse xianshipintuanCourse = courseService.xianshipintuanCourse();
        ServiceResponse jinzhanbixueCourseResponse  = courseService.jinzhanbixueCourse();
        ServiceResponse xinshanghaokeCourseResponse  = courseService.xinshanghaokeCourse();

        ModelAndView mav = new ModelAndView();
        //1. 新上好课 课程数据
        mav.addObject("xinshanghaokeCourseResponse",xinshanghaokeCourseResponse);// 2.进站必学课程数据
        // 2.进站必学课程数据
        mav.addObject("jinzhanbixueCourseResponse",jinzhanbixueCourseResponse);// 2.进站必学课程数据
        //  3. 限时拼团课程数据
        mav.addObject("xianshipintuanCourse",xianshipintuanCourse); // 3. 限时拼团课程数据

        mav.setViewName("index");
        System.out.println("OKOK............");
        return mav;
    }
}
